package com.lx.yygh.common.service;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 柳新宽
 * @create 2022-10-27  20:28
 * @describe
 */
@Service
public class RabbitService {
    @Resource
    RabbitTemplate rabbitTemplate;
    /**
     *  发送消息(给rabbitMQ发送message)
     * @param exchange 交换机
     * @param routingKey 路由键
     * @param message 消息
     */
    public boolean sendMessage(String exchange, String routingKey, Object message) {
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
        return true;
    }
}